1. Field of the Invention
The present invention relates to an image processing technology, and more particularly, to an edge detection method, a motion detection method, a pixel interpolation method utilizing up-sampling, and apparatuses thereof.
2. Description of the Prior Art
Pixel interpolation operations are an image processing technique that has widespread applications. For example, pixel interpolation operations are used for generating desired pixel values when performing an image de-interlacing process or image scaling process. Hence, how pixel interpolation operations are implemented imposes quite an influence on image quality. However, applying conventional pixel interpolation methods may lead to inferior image quality if certain patterns appear in the images upon which they are applied.
Please refer to FIG. 1. FIG. 1 is a diagram showing performing edge detection when performing an intra-field interpolation according to the conventional art. In each image field (be it an odd image field or an even image field), a plurality of scan lines are included, whereof each scan line includes a plurality of pixels. For easy explanation, only two scan lines (herein termed as a first scan line and a third scan line) of the odd image field are shown, each of which respectively shows seven pixels: P11, P12, P13, P14, P15, P16, P17 in the first scan line, and P31, P32, P33, P34, P35, P36, P37 in the third scan line, and it is assumed that the pattern in the original picture is an oblique white line extending from the upper right corner to lower left corner at an image area comprising the above listed pixels. Hence, pixel values of the seven pixels of the first scan line are respectively 0, 0, 0, 0, 255, 255, and 0, while pixel values of the seven pixels of the third scan line are respectively 0, 255, 255, 0, 0, 0, and 0 (a pixel value of 0 represents the color of black and 255 represents while). Obviously, when performing interpolation using the first scan line and the third scan line to render a second scan line which lies therebetween, in order to correctly reconstruct an oblique white line, theoretically speaking the interpolation should result in a pixel value of a pixel P24 of the second scan line to be 225. However, if, during inter-field interpolation, edge detection is performed based on a well known and commonly adopted three-pixel block search technique, an edge along the upper right-lower left direction will not be chosen; to the contrary, an edge along the upper left-lower right direction will be chosen. This will lead to an incorrect interpolation result of the pixel value of P24 being 0, which in turn results in unpleasant visual effect such as broken lines and flickering in the image displayed.
Please refer to FIG. 2, which is a diagram showing performing motion detection during a de-interlacing operation in the conventional art. As shown in FIG. 2, a frame 200, with its pixel values on the various pixel lines being respectively (255, 255, 255), (255, 255, 255), (255, 255, 255), (0, 0, 0), (0, 0, 0), and (255, 255, 255), is composed of an odd image field 210, comprising pixels (Po11, Po12, Po13), (Po21, Po22, Po23), and (Po31, Po32, Po33), and an even image field 220, comprising pixels (Pe11, Pe12, Pe13), (Pe21, Pe22, Pe23), and (Pe31, Pe32, Pe33). In the conventional art, the determination of whether motion exists where the pixel Po22 of the odd field 210 is located, is generally made by calculating a sum of absolute difference, or SAD, between a plurality of pixels comprising Po22 and its neighboring pixels Po11, Po12, Po13, Po21, Po23, Po31, Po32, and Po33, and a plurality of pixels comprising those pixels located at corresponding positions in an adjacent field, such as the even field; for example, the pixel Pe22 and its neighboring pixels Pe11, Pe12, Pe13, Pe21, Pe22 Pe23, Pe31, Pe32, and Pe33, and then checking if the SAD exceeds a threshold value, such as 1500. If the SAD exceeds the threshold, it is determined to have motion; otherwise, it is determined as still. For example, the frame 200 is actually a still image, but in this case because the SAD is calculated as 1530 (255×6), which is larger than the threshold value 1500, the image is viewed as having motion. As a result, intra-field interpolation is selected over inter-field interpolation for de-interlacing at the pixel Po22 of the odd image field 210, which eventually causes image flicker phenomenon.